package se.ytterman.jpcap.examples.arp;

import java.lang.*;
import java.util.*;
import java.io.*;

import org.xml.sax.InputSource;

import se.ytterman.jpcap.jni.PcapInterfaceFactory;
import se.ytterman.jpcap.jni.PcapInterface;
import se.ytterman.jpcap.jni.PcapSocket;

import se.ytterman.jpcap.framework.system.SystemConfiguration;
import se.ytterman.jpcap.framework.factory.RequestFactory;
import se.ytterman.jpcap.framework.parser.ResponseParser;

public class ArpMain {
    public static void main(String[] argv) {

	if(argv.length == 0) {
	    // Print usage string
	    System.out.println("Usage: se.ytterman.jpcap.PcapApplication <config-file>");
	}
	else {
	    // 
	    try {
		// Debug information...
		if(true) 
		    System.out.println("Jethernet 0.1 framework initializing...");
		
		// Debug information...
		if(true)
		    System.out.println("Opening config file... (" + argv[0] + ")");

		// Create a file
		File xmlFile = new File(argv[0]);

		if(true)
		    System.out.println("Selecting interface...");

		// Open input source...
		InputSource systemSource = new InputSource(new FileInputStream(xmlFile));

		// Parse interface identification and configuration XXX should be instance
		SystemConfiguration.parseSystemConfiguration(systemSource);

		if(true)
		    System.out.println("Compiling frame factories...");

		// Open input source...
		InputSource requestSource = new InputSource(new FileInputStream(xmlFile));

		// Parse request factory configuration XXX should be instance
		RequestFactory.parseRequestConfiguration(requestSource);

		// Parser response factory configuration XXX should be instance

		if(false)
		    System.out.println("Compiling frame parsers...");

		// Parse response...
		// InputSource parserSource = new InputSource(new FileInputStream(xmlFile));
		// PcapApplication.parseResponse(parserSource);
	    }
	    catch(Exception e) {

	    }
	}
    }
}
